import 'package:flutter/widgets.dart';
import 'package:meePet/app/LocalColor.dart';
import 'package:meePet/utils/LogUtils.dart';
import 'package:meePet/utils/ext/SizeExt.dart';
import 'package:meePet/utils/ext/StringExt.dart';

class CommonAppBar extends StatelessWidget {
  final String tittle;
  final Function clickListener;

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(top: 44.sw()),
      child: Row(
        children: [
          GestureDetector(
            onTap: () {
              LogUtils.i("点击返回");
              clickListener.call();
            },
            child: Container(
              margin: EdgeInsets.only(left: 12.sw()),
              child: "comon_back_black".png().loadImageRes(30.sw(),30.sw()),
            ),
          ),
          Expanded(
              child: Container(
                margin: EdgeInsets.only(right: 42.sw()),
            child: Text(
              tittle,
              style: TextStyle(color: LocalColor.colorBlack, fontSize: 14.sw()),
              textAlign: TextAlign.center,
            ),
          ))
        ],
      ),
    );
  }

  CommonAppBar(this.tittle, this.clickListener) {}
}
